#! /bin/sh

# Copyright (C) 2021 Bob Tennent <rdt@cs.queensu.ca>
# You may freely use, modify and/or distribute this file.

rm -f barsant* pmxaerr.dat
if test -r "$srcdir/tests/barsant.pmx"; then
  : # standalone pmx
elif test -r "$srcdir/pmx-src/tests/barsant.pmx"; then
  srcdir=$srcdir/pmx-src # in TL
else
  echo "$0: cannot find tests/barsant.pmx" >&2
  exit 1
fi


cp "$test_src/barsant.pmx" . || exit 1

failed=

./scor2prt barsant \
        && diff barsant1.pmx $test_src/barsant1.pmx \
        && diff barsant2.pmx $test_src/barsant2.pmx \
        || failed="$failed scor2prt"

./pmxab barsant \
        && diff barsant.mid $test_src/barsant.mid \
        && diff barsant.pml $test_src/barsant.pml \
        && diff barsant.tex $test_src/barsant.tex \
        || failed="$failed pmxab"

test -z "$failed" && exit 0
echo "failed tests:$failed"
exit 1

